﻿
@{
    ViewBag.Title = Resources.WebStringsWeb.WebTitle;
    Layout = "~/Views/Shared/_LayoutMobile.cshtml";
}
@section css {
    <style>
        .mui-bar ~ .mui-content .mui-scroll-wrapper {
            top: 44px;
            height: auto;
        }
    </style>
}
<header class="mui-bar mui-bar-nav">
    <button type="button" class="mui-left mui-action-back mui-btn mui-btn-link mui-btn-nav mui-pull-left" style="color:white;">
        <span class="mui-icon mui-icon-left-nav" style=""></span>
    </button>
    <h1 class="mui-title" style="color:white;">检查登记</h1>
</header>
<div class="mui-content" style="margin: 5px;" ng-cloak ng-controller="CheckFormController" ng-init="
      RoomId = '@(Request.QueryString["RoomId"].IsEmpty() ? "" : Request.QueryString["RoomId"])';
     PlaceId='@(Request.QueryString["PlaceId"].IsEmpty() ? "" : Request.QueryString["PlaceId"])';
      PlaceName='@(Request.QueryString["PlaceName"].IsEmpty() ? "" : Request.QueryString["PlaceName"])';
     PageName='@(Request.QueryString["PageName"].IsEmpty() ? "" : Request.QueryString["PageName"])';
      CheckTypeId='@(Request.QueryString["CheckTypeId"].IsEmpty() ? "0" : Request.QueryString["CheckTypeId"])';
     AddModel={};
     GetPlaceDepartment(PlaceId,AddModel);
     GetCheckTypeList(RoomId,PlaceId);
     AddModel.RoomId = RoomId;
     AddModel.FormNo = 'C'+'@DateTime.Now.ToString("yyMMddHHmmssfff")';
     AddModel.CheckTime = '@DateTime.Now.ToString("yyyy-MM-dd")';
     ImageCount = [0,1,2];
     CheckItems=[];
     FileList = [];
     Loading = false;
     AddModel.PlaceId=PlaceId;
     AddModel.PlaceName = PlaceName;
     ">
    <form class="mui-input-group">
        <div class="mui-input-row">
            <label>部门</label>
            <input type="text" ng-model="AddModel.DepartmentName" readonly />
        </div>
        <div class="mui-input-row">
            <label>部位名称</label>
            <input type="text" ng-model="PlaceName" readonly />
        </div>
        <div class="mui-input-row">
            <label>部门负责人</label>
            <input type="text" ng-model="AddModel.Manager" readonly />
        </div>
        <div class="mui-input-row">
            <label>责任人</label>
            <input type="text" ng-model="AddModel.ResponsibleName" readonly>
        </div>
        <div class="mui-input-row">
            <label>检查日期</label>
            <input type="text" ng-model="AddModel.CheckTime" readonly>
        </div>
        <div class="mui-input-row">
            <label>检查类型</label>
            <select ng-model="AddModel.CheckType" ng-change="GetCheckItemList(RoomId,AddModel.CheckType)">
                <option ng-repeat="x in CheckTypeList" value="{{x.Id}}">{{x.IntervalName}}</option>
            </select>
        </div>
        <div class="mui-input-row">
            <label>检查人</label>
            <input type="text" ng-model="User.UserName" readonly>
        </div>
    </form>
    <div class="mui-card">
        <ul class="mui-table-view">
            <li ng-show="CheckItemList==null || CheckItemList.length==0">
                <span style="color:red;">暂未分配检查任务</span>
            </li>
            <li class="mui-table-view-cell mui-collapse" ng-repeat="x in CheckItemList">
                <a ng-init="CheckItems[$index].SortBy=x.SortBy" class="mui-navigate-right" style="white-space:unset;">
                    {{$index+1}}.{{x.CheckContent}}<span ng-show="x.IsValue && (CheckItems[$index].DataValue==null||CheckItems[$index].DataValue=='')" style="color:red;">(请输入测量值)</span><br />
                    <span ng-show="CheckItems[$index].Result==1" style="color:green;font-weight:bold;">正常</span><span ng-show="CheckItems[$index].Result==0" style="color: red; font-weight: bold;">异常</span>
                </a>
                <div class="mui-collapse-content" ng-init="CheckItems[$index].OptionId=x.OptionId">
                    <form class="mui-input-group" ng-init="CheckItems[$index].Result=1">
                        <div class="mui-input-row" ng-show="x.IsValue">
                            <label>&nbsp;&nbsp;测量值<span style="color:red">*</span></label>
                            <input type="text" ng-model="CheckItems[$index].DataValue" placeholder="测量值">
                        </div>
                        <div class="mui-input-row mui-radio mui-left">
                            <label>正常</label>
                            <input name="radio1" type="radio" ng-click="CheckItems[$index].Result=1" checked="checked">
                        </div>
                        <div class="mui-input-row mui-radio mui-left">
                            <label>异常</label>
                            <input name="radio1" ng-click="CheckItems[$index].Result=0" type="radio">
                        </div>

                        <div class="mui-input-row">
                            <label>&nbsp;&nbsp;&nbsp;&nbsp;备注</label>
                            <input type="text" ng-model="CheckItems[$index].Remark" placeholder="此处输入备注">
                        </div>
                    </form>
                    <p style="margin-top:30px;">上传照片（总大小在10M以下）</p>
                    <div class="row image-list" style="margin-top:20px;">
						<img class="image-item space" src="../../Assets/img/upload.png" style="width:55px;height:auto;margin:5px;" ng-repeat="y in ImageCount" id="imagebox-{{x.OptionId}}_{{y}}" ng-click="InitLxImgUpload('imagebox-',x.OptionId,y)"/>
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <p ng-show="1==2">问题或建议</p>
    <div ng-show="1==2" class="mui-input-row" style="margin: 10px 5px;">
        <textarea id="textarea" rows="5" placeholder="问题或建议" ng-model="AddModel.Description"></textarea>
    </div>

    <div class="mui-button-row" style="margin-bottom:80px;">
        @*<button type="button" ng-click="MSaveCheckForm(0,AddModel,CheckItems,FileList);" ng-disabled="Loading" class="mui-btn mui-btn-primary mui-btn-block mui-btn-outlined">保 &nbsp;&nbsp;存</button>*@
        <button type="button" ng-show="AddModel.CheckType!=null" ng-click="MSaveCheckForm(1,AddModel,CheckItems,FileList,PageName);" ng-disabled="Loading" class="mui-btn mui-btn-primary mui-btn-block">提 &nbsp;&nbsp;交</button>
    </div>

</div>

@section js{
    <script src="~/Assets/js/base/app-jssdk.umd.min.js"></script>
    <script src="~/Assets/js/libs/upload.js"></script>
    <script src="~/Assets/js/pg/MCheckForm.js?v=@DateTime.Now.ToString("yyyyMMddHH")"></script>
    <script>
        mui.showLoading("正在加载..", "div");

        setTimeout(function () {
            mui.hideLoading();
        }, 2000);
    </script>
}